package com.neusoft.neuiotms.dcom.task.hn;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

import com.neusoft.neuiotms.dcom.config.ScheduledReportConfiguration.ReportType;
import com.neusoft.neuiotms.dcom.service.MonthWeeklyService;
import com.neusoft.neuiotms.dcom.service.OperationSupportWeeklyService;
import com.neusoft.neuiotms.dcom.service.WorkDailyService;

/**
 * 日、周、月报提醒
 *
 * @author sunchf
 */
public class HnReportTaskJob extends QuartzJobBean {
    @Autowired
    private WorkDailyService workDailyService;
    @Autowired
    private OperationSupportWeeklyService operationSupportWeeklyService;
    @Autowired
    private MonthWeeklyService monthWeeklyService;

    @Override
    protected void executeInternal(final JobExecutionContext context) throws JobExecutionException {
        final String typeStr = (String) context.getMergedJobDataMap().get("type");
        final ReportType type = ReportType.valueOf(typeStr);
        switch (type) {
        case day:
            this.workDailyService.checkDailyReportNotice();
            break;
        case week:
            this.operationSupportWeeklyService.checkReportNotice();
            break;
        case month:
            this.monthWeeklyService.checkReportNotice();
            break;
        default:
            break;
        }

    }
}
